package com.findu.activity;

import com.example.findu.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

/**
 * An example full-screen activity that shows and hides the system UI (i.e.
 * status bar and navigation/system bar) with user interaction.
 * 
 * @see SystemUiHider
 */
public class WelcomeActivity extends Activity {
	/**
	 * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
	 * user interaction before hiding the system UI.
	 */
	private static final int START_DELAY_MILLIS = 100;

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_welcome);
	}

	@Override
	protected void onPostCreate(Bundle savedInstanceState) {
		super.onPostCreate(savedInstanceState);

		// Trigger the initial hide() shortly after the activity has been
		// created, to briefly hint to the user that UI controls
		// are available.
		delayedStart(START_DELAY_MILLIS);
	}

	Handler mStartHandler = new Handler();
	Runnable mStartRunnable = new Runnable() {
		@Override
		public void run() {
			// to do: start login
			Intent intent= new Intent(WelcomeActivity.this, LoginActivity.class);
			startActivity(intent);
			finish();
		}
	};

	/**
	 * Schedules a call to hide() in [delay] milliseconds, canceling any
	 * previously scheduled calls.
	 */
	private void delayedStart(int delayMillis) {
		mStartHandler.removeCallbacks(mStartRunnable);
		mStartHandler.postDelayed(mStartRunnable, delayMillis);
	}
}
